package nl.memedefense.screen;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL10;
import com.badlogic.gdx.graphics.Pixmap;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.math.Matrix4;
import nl.memedefense.level.Level;

public class GameScreen implements Screen {

    private Level level;
    private SpriteBatch batch;
    private final Matrix4 viewMatrix = new Matrix4();
    private final Matrix4 transformMatrix = new Matrix4();

    /**
     * Constructs a new GameScreen with the given level that should be rendered.
     *
     * @param level {@link Level} that should be rendered.
     */
    public GameScreen(Level level) {
        this.level = level;
        this.batch = new SpriteBatch();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void render(float delta) {
        Gdx.app.getGraphics().getGL10().glClear(GL10.GL_COLOR_BUFFER_BIT);

        FileHandle backgroundImage = Gdx.files.internal("background.png");
        Texture background = new Texture(backgroundImage, true);

        background.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);

        transformMatrix.setToScaling(1, 1, 1);
        viewMatrix.setToOrtho2D(0, 0, 480, 320);

        batch.setTransformMatrix(transformMatrix);
        batch.setProjectionMatrix(viewMatrix);
        batch.begin();
        batch.draw(background, 0, 0, 0, 0, 512, 512);
        batch.end();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void resize(int width, int height) {

    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void show() {

    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void hide() {

    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void pause() {

    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void resume() {

    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void dispose() {

    }
}
